package edu.dongthang.screens;


import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

@SuppressLint("SetJavaScriptEnabled")
public class HelpScreens extends Activity {
	WebView webView;
	private ProgressDialog dialog;
	@Override
	protected void onCreate(Bundle savedInstanceState)
			throws NullPointerException {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_webview_help);
		
		webView = (WebView) findViewById(R.id.web_view);
		WebSettings webSettings = webView.getSettings();
		webSettings.setSavePassword(false);
		webSettings.setSaveFormData(false);
		webSettings.setJavaScriptEnabled(true);
		webSettings.setSupportZoom(false);
		webView.setWebViewClient(new WebviewCliens());
		dialog = ProgressDialog.show(this, "", "Đang tải ...");
		new NewTask().execute();
		
	}

	class NewTask extends AsyncTask<Void, Void, Void> {
		@Override
		protected Void doInBackground(Void... params) {
			webView.loadUrl("http://remoteslide.jimdo.com/h%C6%B0%E1%BB%9Bng-d%E1%BA%ABn/");
			return null;
		}
	}
	
	class WebviewCliens extends WebViewClient{
		@Override
		public void onPageFinished(WebView view, String url) {
			if(dialog!=null){
				dialog.dismiss();
			}
			super.onPageFinished(view, url);
		}
		
	}
}
